package com.yidu.t299.dao.ljc;
import com.yidu.t299.domain.ljc.Goodscheck;
import org.apache.ibatis.annotations.*;
import java.util.List;

/**
 * @author 刘建常
 * @version 1.0
 * @description
 * @date:2023/3/20 8:38
 */
@Mapper
public interface GoodscheckMapper {
    @Insert({
            "insert into goods_check (goods_check_id, in_name,booker_id,goods_check_date,ment)" +
                    " values (#{checkId,jdbcType=INTEGER}, #{inName,jdbcType=VARCHAR}," +
                    "#{bookerId,jdbcType=VARCHAR},#{checkDate,jdbcType=VARCHAR}," +
                    "#{ment,jdbcType=VARCHAR})"
    })
    int insert(Goodscheck record);


    @Delete({
            "delete from goods_check" +
                    " where goods_check_id = #{checkId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer checkId);


    @Update({
            "update goods_check"+
            " set in_name = #{inName,jdbcType=VARCHAR},"+
                    " booker_id = #{bookerId,jdbcType=INTEGER},"+
                    " goods_check_date = #{checkDate,jdbcType=VARCHAR},"+
                    " ment = #{ment,jdbcType=VARCHAR}"+
                    " where goods_check_id = #{checkId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Goodscheck record);


    @Select({
            "select" +
                    " goods_check_id, in_name,booker_id,goods_check_date,ment" +
                    " from goods_check" +
                    " where goods_check_id = #{checkId,jdbcType=INTEGER}"
    })
    @Results(id = "GoodscheckMap",value = {
            @Result(id = true,column = "goods_check_id",property = "checkId"),
            @Result(column = "in_name",property = "inName"),
            @Result(column = "booker_id",property = "bookerId"),
            @Result(column = "goods_check_date",property = "checkDate"),
            @Result(column = "ment",property = "ment")
    })
    Goodscheck selectByPrimaryKey(Integer checkId);


    @Select("select * from goods_check where 1=1 ${condition} limit #{page},#{rows}")
    @ResultMap("GoodscheckMap")
    List<Goodscheck> selectByPage(@Param("rows") int rows, @Param("page") int page, @Param("condition") String condition);


    @Select("select count(*) from goods_check where 1=1 ${condition}")
    int selectCount(@Param("condition") String condition);


}
